home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume7 / thack < prev    next >
Encoding:
Text File  |  1989-06-03  |  17.7 KB  |  773 lines

  1. Newsgroups: comp.sources.misc
  2. Subject: v07i007: Troff C/A/T to Postscript filter
  3. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  4. Reply-To: everson@compsci.bristol.ac.uk
  5.  
  6. Posting-number: Volume 7, Issue 7
  7. Submitted-by: everson@compsci.bristol.ac.uk
  8. Archive-name: thack
  9.  
  10. Enclosed please find thack, a Troff C/A/T to Postscript filter, written
  11. by a colleague of mine, Gareth Waddell.
  12.  
  13. Sample usage of thack is, say:
  14.  
  15.     troff -t -man /usr/man/sh.1 | thack | lpr -Ppostscript
  16.  
  17. It does not claim to be perfect, but I personally have used it for
  18. printing many documents in the past, especially manual pages and found
  19. it very useful.
  20.  
  21. It was written under SunOS3.5, but has been run on a 3B2 running System V
  22. and produces particularly nice output under SunOS4.0 or later as Sun
  23. altered the troff font width tables to match those of Postscript at
  24. that release.
  25.  
  26. The Postscript produced by this program has been successfully printed
  27. on an Apple Laserwriter I and an Apple Laserwriter IINTX. It can also
  28. be previewed under Sunview with the Rutherford Postscript Interpreter.
  29.  
  30. Phill Everson
  31. Computer Science Dept.,
  32. University of Bristol, UK
  33.  
  34. #! /bin/sh
  35. # This is a shell archive.  Remove anything before this line, then unpack
  36. # it by saving it into a file and typing "sh file".  To overwrite existing
  37. # files, type "sh file -c".  You can also feed this as standard input via
  38. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  39. # will see the following message at the end:
  40. #        "End of archive 1 (of 1)."
  41. # Contents:  COPYRIGHT MANIFEST Makefile th.h thack.1 thack.c
  42. # Wrapped by everson@kukini on Mon May 22 12:29:59 1989
  43. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  44. if test -f 'COPYRIGHT' -a "${1}" != "-c" ; then 
  45.   echo shar: Will not clobber existing file \"'COPYRIGHT'\"
  46. else
  47. echo shar: Extracting \"'COPYRIGHT'\" \(1092 characters\)
  48. sed "s/^X//" >'COPYRIGHT' <<'END_OF_FILE'
  49. Copyright 1989 Gareth Waddell
  50. X
  51. This notice and any statement of authorship must be reproduced
  52. on all copies.  The author does not make any warranty expressed
  53. or implied, or assumes any liability or responsiblity for the
  54. use of this software.
  55. X
  56. Any distributor of copies of this software shall grant the
  57. recipient permission for further redistribution as permitted
  58. by this notice.  Any distributor must distribute this software
  59. without any fee or other monetary gains, unless expressed written
  60. permission is granted by the author.
  61. X
  62. This software or its use shall not be: sold, rented, leased,
  63. traded, or otherwise marketed without the expressed written
  64. permission of the author.
  65. X
  66. If the software is modified in a manner creating derivative
  67. copyrights, appropriate legends may be placed on derivative
  68. work in addition to that set forth above.
  69. X
  70. Permission is hereby granted to copy, reproduce, redistribute or
  71. otherwise use this software as long as the conditions above
  72. are met.
  73. X
  74. All rights not granted by this notice are reserved.
  75. X
  76. Author: Gareth Waddell
  77. X        Phill Everson <everson@uk.ac.bris.cs>
  78. END_OF_FILE
  79. if test 1092 -ne `wc -c <'COPYRIGHT'`; then
  80.     echo shar: \"'COPYRIGHT'\" unpacked with wrong size!
  81. fi
  82. # end of 'COPYRIGHT'
  83. fi
  84. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  85.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  86. else
  87. echo shar: Extracting \"'MANIFEST'\" \(300 characters\)
  88. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  89. X   File Name        Archive #    Description
  90. X-----------------------------------------------------------
  91. X COPYRIGHT                  1    
  92. X MANIFEST                   1    This shipping list
  93. X Makefile                   1    
  94. X th.h                       1    
  95. X thack.1                    1    
  96. X thack.c                    1    
  97. END_OF_FILE
  98. if test 300 -ne `wc -c <'MANIFEST'`; then
  99.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  100. fi
  101. # end of 'MANIFEST'
  102. fi
  103. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  104.   echo shar: Will not clobber existing file \"'Makefile'\"
  105. else
  106. echo shar: Extracting \"'Makefile'\" \(91 characters\)
  107. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  108. X.PRECIOUS: thack.c th.h
  109. X
  110. thack: thack.o
  111. X    cc -o thack thack.o
  112. X
  113. thack.c: th.h
  114. X    touch thack.c
  115. END_OF_FILE
  116. if test 91 -ne `wc -c <'Makefile'`; then
  117.     echo shar: \"'Makefile'\" unpacked with wrong size!
  118. fi
  119. # end of 'Makefile'
  120. fi
  121. if test -f 'th.h' -a "${1}" != "-c" ; then 
  122.   echo shar: Will not clobber existing file \"'th.h'\"
  123. else
  124. echo shar: Extracting \"'th.h'\" \(366 characters\)
  125. sed "s/^X//" >'th.h' <<'END_OF_FILE'
  126. X#include <stdio.h>
  127. char *table[2][2]=
  128. X    { /* FONT 0,1,2,4,5,6,7 */
  129. X     " htnmlizsdbxfjuk p ; a_c`e'o r v-wq/.g ,&y % QTOHNMLRGIPCVEZDBSY",
  130. X     " FXAWJUK0123456789*       ()[]  = :+ ! ? |   $$$$$$$$$$$$$$$$$$$",
  131. X     /* FONT 3 */
  132. X     " yqnmlizsdbxhfuk p   a c e=o r t_ Y  g   w   FQW  VL-G P    D S ",
  133. X     " >X</ U                   {}   #  ~    *   +  $$$$$$$$$$$$$$$$$$",
  134. X     };
  135. END_OF_FILE
  136. if test 366 -ne `wc -c <'th.h'`; then
  137.     echo shar: \"'th.h'\" unpacked with wrong size!
  138. fi
  139. # end of 'th.h'
  140. fi
  141. if test -f 'thack.1' -a "${1}" != "-c" ; then 
  142.   echo shar: Will not clobber existing file \"'thack.1'\"
  143. else
  144. echo shar: Extracting \"'thack.1'\" \(1324 characters\)
  145. sed "s/^X//" >'thack.1' <<'END_OF_FILE'
  146. X.\" .TH name section cent-foot
  147. X.TH THACK 1 "28 August 1987"
  148. X.SH NAME
  149. X.\" name \- function
  150. thack \- hack about with TROFF output
  151. X.SH SYNOPSIS
  152. X.\" Bold keywords, Italic variables, [] options, | alternatives.
  153. X.B thack
  154. X.SH DESCRIPTION
  155. X.\" Italic files, commands, IR manual-entry (manual-section)
  156. X.I Thack
  157. is a hack to
  158. convert
  159. X.IR troff (1)
  160. output into 
  161. postscript.
  162. The postscript it
  163. produces is not highly
  164. efficient.
  165. X.\".SH OPTIONS
  166. X.\" Itemised list of options
  167. X.\".SH FILES
  168. X.\" List of all files used by the program
  169. X.SH "SEE ALSO"
  170. X.\" List of references, textual, and MAN pages.
  171. troff(1), nroff(1), eqn(1), tbl(1)
  172. X.br
  173. XFormatting Documents on the Sun Workstation
  174. X.br
  175. Postscript Language Reference Manual
  176. X.SH DIAGNOSTICS
  177. X.\" List of error messages and return codes the user may expect
  178. Cryptic Messages such as L3/16 indicate
  179. that an uncatered for code has been
  180. sent (24 have yet to be identified).
  181. More interesting messages such
  182. as 'Sequence Bell Logo is not allowed'
  183. are also printed. There are five of these
  184. cases. However, some illegal sequences are 
  185. intercepted and used
  186. as additional font information.
  187. X.SH BUGS
  188. X.\" Known Limitations or Desirable additions to the command
  189. Like all hacks, there are plenty.
  190. X.br
  191. The code is highly inefficient.
  192. X.br
  193. Many Special characters are Wrong.
  194. X.br
  195. XEqn(1) & Tbl(1) are not 100% compatible.
  196. END_OF_FILE
  197. if test 1324 -ne `wc -c <'thack.1'`; then
  198.     echo shar: \"'thack.1'\" unpacked with wrong size!
  199. fi
  200. # end of 'thack.1'
  201. fi
  202. if test -f 'thack.c' -a "${1}" != "-c" ; then 
  203.   echo shar: Will not clobber existing file \"'thack.c'\"
  204. else
  205. echo shar: Extracting \"'thack.c'\" \(10227 characters\)
  206. sed "s/^X//" >'thack.c' <<'END_OF_FILE'
  207. X#include "th.h"
  208. X
  209. int xpos, ypos, cx, cy;
  210. int font, cfont, size, csize, tfont, tsize;
  211. char *pstr, *cstr();
  212. X
  213. main()
  214. X{
  215. X    int c, i;
  216. X    int sflag;
  217. X    int hdist, vdist;
  218. X    int esc, lead;
  219. X    int fh;
  220. X
  221. X    hdist = vdist = 0;
  222. X    cfont = csize = -1;
  223. X    tfont = font = 0;
  224. X    tsize = size = 12;
  225. X    esc = lead = 1;
  226. X    cy = ypos = 1692;
  227. X    cx = xpos = 0;
  228. X    sflag = 0;
  229. X    prolog();
  230. X    newpage();
  231. X    while ((c = getchar()) != EOF) {
  232. X        font = tfont;
  233. X        size = tsize;
  234. X        if (c & 0x80)
  235. X            hdist += ~c & 0x7f;
  236. X        else if ((c & 0xe0) == 0x60)
  237. X            vdist += ~c & 0x1f;
  238. X        if ((c & 0xc0) == 0) {
  239. X            if ((c & 0x3f) != 0) {
  240. X                if (hdist || vdist) {
  241. X                    xpos += esc * hdist;
  242. X                    ypos -= lead * vdist;
  243. X                    if (ypos <= 0) {
  244. X                        endpage();
  245. X                        newpage();
  246. X                        while (ypos < 0)
  247. X                            ypos += 1584;
  248. X                    }
  249. X                    hdist = 0;
  250. X                    vdist = 0;
  251. X                }
  252. X                sflag = 1;
  253. X                if (table[(font % 4) == 3][fh][c & 0x3f] == ' ') {
  254. X                    if (font % 4 != 3)
  255. X                        if (fh == 0)
  256. X                            switch (c & 0x3f) {
  257. X                            case 18:
  258. X                                pstr = "\\320";
  259. X                                break;    /* \(em */
  260. X                            case 28:
  261. X                                illegal("1/4");
  262. X                                break;    /* \(14 */
  263. X                            case 30:
  264. X                                illegal("1/2");
  265. X                                break;    /* \(12 */
  266. X                            case 38:
  267. X                                illegal("3/4");
  268. X                                break;    /* \(34 */
  269. X                            default:
  270. X                                fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  271. X                            }
  272. X                        else
  273. X                            switch (c & 0x3f) {
  274. X                            case 19:
  275. X                                pstr = "\\320";
  276. X                                break;    /* \- */
  277. X                            case 20:
  278. X                                pstr = "\\256";
  279. X                                break;    /* fi */
  280. X                            case 21:
  281. X                                pstr = "\\257";
  282. X                                break;    /* fl */
  283. X                            case 22:
  284. X                                pstr = "ff";
  285. X                                break;    /* ff */
  286. X                            case 23:
  287. X                                pstr = "\\242";
  288. X                                break;    /* cent */
  289. X                            case 24:
  290. X                                pstr = "f\\257";
  291. X                                break;    /* ffl */
  292. X                            case 25:
  293. X                                pstr = "f\\256";
  294. X                                break;    /* ffi */
  295. X                            case 30:
  296. X                                fontps(3, size, "\\260");
  297. X                                break;    /* degree */
  298. X                            case 31:
  299. X                                pstr = "\\262";
  300. X                                break;    /* dagger */
  301. X                            case 33:
  302. X                                fontps(3, size, "\\322");
  303. X                                break;    /* reg */
  304. X                            case 38:
  305. X                                pstr = "\\267";
  306. X                                break;    /* bullet */
  307. X                            case 40:
  308. X                                fontps(3, size, "\\242");
  309. X                                break;    /* footmark */
  310. X                            case 43:
  311. X                                fontps(3, size, "\\323");
  312. X                                break;    /* c'right */
  313. X                            case 44:
  314. X                                pstr = "\\250";
  315. X                                break;    /* square ? */
  316. X                            default:
  317. X                                fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  318. X                            }
  319. X                    else if (fh == 0)
  320. X                        switch (c & 0x3f) {
  321. X                        case 18:
  322. X                            fontps(0, size, "@");
  323. X                            break;    /* @ */
  324. X                        case 19:
  325. X                            pstr = "\\257";
  326. X                            break;    /* down arrow */
  327. X                        case 22:
  328. X                            pstr = cstr('|');
  329. X                            break;    /* OR */
  330. X                        case 24:
  331. X                            fontps(0, size, "\"");
  332. X                            break;    /* " */
  333. X                        case 28:
  334. X                            pstr = "\\254";
  335. X                            break;    /* <- */
  336. X                        case 30:
  337. X                            pstr = "\\255";
  338. X                            break;    /* up arrow */
  339. X                        case 33:
  340. X                            fontps(0, size, "\\\\");
  341. X                            break;    /* Backslash ! */
  342. X                        case 35:
  343. X                            illegal("Bell Logo");
  344. X                            break;    /* Bell Logo */
  345. X                        case 36:
  346. X                            pstr = "\\245";
  347. X                            break;    /* infinity */
  348. X                        case 38:
  349. X                            pstr = "\\312";
  350. X                            break;    /* impr. super */
  351. X                        case 39:
  352. X                            pstr = "\\265";
  353. X                            break;    /* proportional */
  354. X                        case 40:
  355. X                            pstr = "\\336";
  356. X                            break;    /* right hand */
  357. X                        case 43:
  358. X                            pstr = "\\321";
  359. X                            break;    /* grad */
  360. X                        case 48:
  361. X                            pstr = "\\310";
  362. X                            break;    /* union */
  363. X                        case 49:
  364. X                            pstr = "\\140";
  365. X                            break;    /* sqrtroof */
  366. X                        case 54:
  367. X                            pstr = "\\362";
  368. X                            break;    /* integral */
  369. X                        case 56:
  370. X                            pstr = "\\314";
  371. X                            break;    /* subset */
  372. X                        case 57:
  373. X                            pstr = "\\311";
  374. X                            break;    /* superset */
  375. X                        case 58:
  376. X                            pstr = cstr('~');
  377. X                            break;    /* approximate */
  378. X                        case 59:
  379. X                            pstr = "\\256";
  380. X                            break;    /* partial */
  381. X                        case 61:
  382. X                            pstr = "\\326";
  383. X                            break;    /* sqrt */
  384. X                        case 63:
  385. X                            pstr = "\\273";
  386. X                            break;    /* ~= */
  387. X                        default:
  388. X                            fprintf(stderr, ">>>>> L%d/%d\n", font, c & 0x3f);
  389. X                        }
  390. X                    else
  391. X                        switch (c & 0x3f) {
  392. X                        case 5:
  393. X                            pstr = "\\307";
  394. X                            break;    /* intersect */
  395. X                        case 7:
  396. X                            pstr = "\\330";
  397. X                            break;    /* not */
  398. X                        case 8:
  399. X                            pstr = "\\371";
  400. X                            break;    /* righceil, sq */
  401. X                        case 9:
  402. X                            pstr = "\\354";
  403. X                            break;    /* leftop, curly */
  404. X                        case 10:
  405. X                            pstr = "\\357";
  406. X                            break;    /* bold vertical */
  407. X                        case 11:
  408. X                            pstr = "\\355";
  409. X                            break;    /* lefcent, curly */
  410. X                        case 12:
  411. X                            pstr = "\\356";
  412. X                            break;    /* leftbot, curly */
  413. X                        case 13:
  414. X                            pstr = "\\374";
  415. X                            break;    /* rightop, curly */
  416. X                        case 14:
  417. X                            pstr = "\\375";
  418. X                            break;    /* righcen, curly */
  419. X                        case 15:
  420. X                            pstr = "\\376";
  421. X                            break;    /* rightbot, curly */
  422. X                        case 16:
  423. X                            pstr = "\\373";
  424. X                            break;    /* rigfloor, sq */
  425. X                        case 17:
  426. X                            pstr = "\\353";
  427. X                            break;    /* lefloor, sq */
  428. X                        case 18:
  429. X                            pstr = "\\351";
  430. X                            break;    /* leftceil, sq */
  431. X                        case 19:
  432. X                            pstr = "\\264";
  433. X                            break;    /* times */
  434. X                        case 20:
  435. X                            pstr = "\\270";
  436. X                            break;    /* divide */
  437. X                        case 21:
  438. X                            pstr = "\\261";
  439. X                            break;    /* +- */
  440. X                        case 22:
  441. X                            pstr = "\\243";
  442. X                            break;    /* <= */
  443. X                        case 23:
  444. X                            pstr = "\\263";
  445. X                            break;    /* >= */
  446. X                        case 24:
  447. X                            pstr = "\\272";
  448. X                            break;    /* ident. equ */
  449. X                        case 25:
  450. X                            pstr = "\\271";
  451. X                            break;    /* != */
  452. X                        case 28:
  453. X                            fontps(0, size, "\\302");
  454. X                            break;    /* acute */
  455. X                        case 29:
  456. X                            fontps(0, size, "\\301");
  457. X                            break;    /* grave */
  458. X                        case 30:
  459. X                            fontps(0, size, "^");
  460. X                            break;    /* ^ */
  461. X                        case 32:
  462. X                            pstr = "\\334";
  463. X                            break;    /* left hand */
  464. X                        case 33:
  465. X                            pstr = "\\316";
  466. X                            break;    /* Member of */
  467. X                        case 35:
  468. X                            pstr = "\\306";
  469. X                            break;    /* Empty set */
  470. X                        case 37:
  471. X                            fontps(0, size, "\\263");
  472. X                            break;    /* doubdagg */
  473. X                        case 38:
  474. X                            pstr = "\\275";
  475. X                            break;    /* box vertical */
  476. X                        case 40:
  477. X                            pstr = "\\315";
  478. X                            break;    /* impr. subset */
  479. X                        case 41:
  480. X                            illegal("circle");
  481. X                            break;    /* circle */
  482. X                        case 44:
  483. X                            pstr = "\\256";
  484. X                            break;    /* -> */
  485. X                        case 45:
  486. X                            fontps(0, size, "\\247");
  487. X                            break;    /* section */
  488. X                        default:
  489. X                            fprintf(stderr, ">>>>> U%d/%d\n", font, c & 0x3f);
  490. X                        }
  491. X                }
  492. X                else {
  493. X                    switch (table[(font % 4) == 3][fh][c & 0x3f]) {
  494. X                    case '(':
  495. X                        pstr = "\\(";
  496. X                        break;
  497. X                    case ')':
  498. X                        pstr = "\\)";
  499. X                        break;
  500. X                    default:
  501. X                        pstr = cstr(table[(font % 4) == 3][fh][c & 0x3f]);
  502. X                        break;
  503. X                    }
  504. X                }
  505. X                tprint();
  506. X            }
  507. X        }
  508. X        else if ((c & 0xf0) == 0x50) {
  509. X            switch (c & 0x0f) {
  510. X            case 0:
  511. X                size = 7;
  512. X                break;
  513. X            case 1:
  514. X                size = 8;
  515. X                break;
  516. X            case 2:
  517. X                size = 10;
  518. X                break;
  519. X            case 3:
  520. X                size = 11;
  521. X                break;
  522. X            case 4:
  523. X                size = 12;
  524. X                break;
  525. X            case 5:
  526. X                size = 14;
  527. X                break;
  528. X            case 6:
  529. X                size = 18;
  530. X                break;
  531. X            case 7:
  532. X                size = 9;
  533. X                break;
  534. X            case 8:
  535. X                size = 6;
  536. X                break;
  537. X            case 9:
  538. X                size = 16;
  539. X                break;
  540. X            case 10:
  541. X                size = 20;
  542. X                break;
  543. X            case 11:
  544. X                size = 22;
  545. X                break;
  546. X            case 12:
  547. X                size = 24;
  548. X                break;
  549. X            case 13:
  550. X                size = 28;
  551. X                break;
  552. X            case 14:
  553. X                size = 36;
  554. X                break;
  555. X            default:
  556. X                fprintf(stderr, "Size: %x\n", c & 0x0f);
  557. X            }
  558. X            crsize(csize, size);
  559. X            tsize = size;
  560. X        }
  561. X        else if ((c & 0xf0) == 0x40) {
  562. X            c &= 0xf;
  563. X            switch (c) {
  564. X            case 0:/* fprintf(stderr,"INIT\n"); */
  565. X                break;
  566. X            case 1:
  567. X                font &= 30;
  568. X                break;
  569. X            case 2:
  570. X                font |= 1;
  571. X                break;
  572. X            case 3:
  573. X                font |= 2;
  574. X                break;
  575. X            case 4:
  576. X                font &= 29;
  577. X                break;
  578. X            case 5:
  579. X                fh = 0;
  580. X                break;
  581. X            case 6:
  582. X                fh = 1;
  583. X                break;
  584. X            case 7:
  585. X                esc = 1;
  586. X                break;
  587. X            case 8:
  588. X                esc = -1;
  589. X                break;
  590. X            case 9:/* fprintf(stderr,"STOP\n"); */
  591. X                break;
  592. X            case 10:
  593. X                lead = 1;
  594. X                break;
  595. X            case 12:
  596. X                lead = -1;
  597. X                break;
  598. X            case 14:
  599. X                font |= 4;
  600. X                break;
  601. X            case 15:
  602. X                font &= 27;
  603. X                break;
  604. X            default:
  605. X                fprintf(stderr, "ILLEGAL\n");
  606. X                break;
  607. X            }
  608. X            tfont = font;
  609. X        }
  610. X    }
  611. X    if (sflag)
  612. X        endpage();
  613. X}
  614. X
  615. tprint()
  616. X{
  617. X    if (font != cfont || size != csize) {
  618. X        printf("%d ", size * 6);
  619. X        switch (font) {
  620. X        case 0:
  621. X            printf("TR");
  622. X            break;
  623. X        case 1:
  624. X            printf("TI");
  625. X            break;
  626. X        case 2:
  627. X            printf("TB");
  628. X            break;
  629. X        case 3:
  630. X            printf("S");
  631. X            break;
  632. X        case 8:
  633. X            printf("H");
  634. X            break;
  635. X        case 9:
  636. X            printf("HO");
  637. X            break;
  638. X        case 10:
  639. X            printf("HB");
  640. X            break;
  641. X        case 11:
  642. X            printf("S");
  643. X            break;
  644. X        case 16:
  645. X            printf("C");
  646. X            break;
  647. X        case 17:
  648. X            printf("CO");
  649. X            break;
  650. X        case 18:
  651. X            printf("CB");
  652. X            break;
  653. X        case 19:
  654. X            printf("S");
  655. X            break;
  656. X        case 24:
  657. X            printf("TBI");
  658. X            break;
  659. X        case 25:
  660. X            printf("HBO");
  661. X            break;
  662. X        case 26:
  663. X            printf("CBO");
  664. X            break;
  665. X        case 27:
  666. X            printf("S");
  667. X            break;
  668. X        default:
  669. X            fprintf(stderr, "Illegal Font %d\n", font);
  670. X        }
  671. X        printf(" F\n");
  672. X        cfont = font;
  673. X        csize = size;
  674. X    }
  675. X    if (ypos == cy)
  676. X        printf("(%s)%d X\n", pstr, xpos);
  677. X    else
  678. X        printf("(%s)%d %d P\n", pstr, xpos, 3 * ypos);
  679. X    cx = xpos;
  680. X    cy = ypos;
  681. X}
  682. X
  683. fontps(f1, ps, str)
  684. char *str;
  685. X{
  686. X    tfont = cfont;
  687. X    tsize = csize;
  688. X    pstr = str;
  689. X    size = ps;
  690. X    font = f1;
  691. X}
  692. X
  693. illegal(s)
  694. char *s;
  695. X{
  696. X    fprintf(stderr, "Sequence %s is not allowed\n", s);
  697. X}
  698. X
  699. crsize(old, new)
  700. X{
  701. X    if ((old == 16 || old >= 20) && (new != 16 && new < 20))
  702. X        xpos += 55;
  703. X    else if ((new == 16 || new >= 20) && (old != 16 && old < 20))
  704. X        xpos -= 55;
  705. X}
  706. X
  707. char *
  708. cstr(c)
  709. char c;
  710. X{
  711. X    static char s[2] = " ";
  712. X
  713. X    *s = c;
  714. X    return s;
  715. X}
  716. X
  717. newpage()
  718. X{
  719. X    printf("save\n");
  720. X}
  721. X
  722. prolog()
  723. X{
  724. X    printf("/P {moveto show} def\n");
  725. X    printf("/X {currentpoint exch pop moveto show} def\n");
  726. X    printf("/F {findfont exch scalefont setfont} def\n");
  727. X    printf("/TR /Times-Roman def\n");
  728. X    printf("/TI /Times-Italic def\n");
  729. X    printf("/TB /Times-Bold def\n");
  730. X    printf("/S /Symbol def\n");
  731. X    printf("/H /Helvetica def\n");
  732. X    printf("/HO /Helvetica-Oblique def\n");
  733. X    printf("/HB /Helvetica-Bold def\n");
  734. X    printf("/C /Courier def\n");
  735. X    printf("/CO /Courier-Oblique def\n");
  736. X    printf("/CB /Courier-Bold def\n");
  737. X    printf("/TBI /Times-BoldItalic def\n");
  738. X    printf("/HBO /Helvetica-BoldOblique def\n");
  739. X    printf("/CBO /Courier-BoldOblique def\n");
  740. X    printf("1 6 div dup scale\n");
  741. X}
  742. X
  743. endpage()
  744. X{
  745. X    printf("showpage\n");
  746. X    printf("restore\n");
  747. X    cfont = csize = -1;    /* Doing this will cause a new font message */
  748. X}
  749. END_OF_FILE
  750. if test 10227 -ne `wc -c <'thack.c'`; then
  751.     echo shar: \"'thack.c'\" unpacked with wrong size!
  752. fi
  753. # end of 'thack.c'
  754. fi
  755. echo shar: End of archive 1 \(of 1\).
  756. cp /dev/null ark1isdone
  757. MISSING=""
  758. for I in 1 ; do
  759.     if test ! -f ark${I}isdone ; then
  760.     MISSING="${MISSING} ${I}"
  761.     fi
  762. done
  763. if test "${MISSING}" = "" ; then
  764.     echo You have the archive.
  765.     rm -f ark[1-9]isdone
  766. else
  767.     echo You still need to unpack the following archives:
  768.     echo "        " ${MISSING}
  769. fi
  770. ##  End of shell archive.
  771. exit 0
  772.  
  773.